# -- coding: utf-8 --
import tensorflow as tf
# 1x2
matrx1 = tf.constant([[3., 3.]])
# 2x1
matrx2 = tf.constant([[2.], [2.]])

# 3 x 2 + 3 x 2 = 12 矩阵乘法
product = tf.matmul(matrx1, matrx2)
# 结果为2x2的矩阵 两个矩阵相加
result = tf.add(matrx1, matrx2)

#基础乘法 (各个元素依次相乘)
result2 = matrx1 * matrx2;

# 打印出张量
print("product:", product)
print ("result:", result)
print ("result2:", result2)
sess = tf.Session()
# result 12
# 获取张量计算结果
print sess.run(product)
print sess.run(result)
print sess.run(result2)
# close session
sess.close()



